#!/usr/bin/perl


print("Removing empty dirs from the current directory\n");

my @dirEntries = <*>;
foreach my $entry (@dirEntries) {
  if ( -d $entry ) {
    print("$entry is an directory, testing it.");
    my @fileList = <$entry/*>;
    my $num = @fileList;
    print(" Found $num entries");
    if ( $num eq 0 ) {
      print(" removing....");
#     sleep 1;
      system(" rmdir $entry ");
    }
    print("\n");
  }
}
